#!/usr/bin/env python
# encoding: utf-8
"""
@author: youfeng
@email: youfeng243@163.com
@license: Apache Licence
@file: send_test_data_to_beanstalk.py
@time: 2018/1/10 10:38
"""

import sys

sys.path.append('..')
sys.path.append('../..')

from common.mongo import MongDb

# 日志模块
from logger import Logger

log = Logger('lanzhou_check_company.log').get_logger()

APP_DATA_DB_SOURCE = {
    'host': '172.16.215.16',
    'port': 40042,
    'db': 'app_data',
    'username': 'work',
    'password': 'haizhi'
}

app_data_db = MongDb(APP_DATA_DB_SOURCE['host'], APP_DATA_DB_SOURCE['port'], APP_DATA_DB_SOURCE['db'],
                     APP_DATA_DB_SOURCE['username'],
                     APP_DATA_DB_SOURCE['password'], log=log)


def main():
    target_table1 = 'enterprise_data_gov'
    with open('兰州项目验收测试名单.txt', 'r') as p_file:
        for line in p_file:
            company = line.strip('\n').strip('\r')
            if app_data_db.find_one(target_table1, {'company': company}) is None:
                log.info("当前企业信息不存在: company = {}".format(company))

    log.info("数据发送完成...")


if __name__ == '__main__':
    main()
